#include <iostream>
#include<cstring>
using namespace std;

class SeqList {
private:
	int* list;
	int maxsize, size;
public:
	SeqList();
	SeqList(int* data,int n);
	~SeqList();
	int list_size();		//实际长度
	int list_insert(int i,int item);	//插入
	int list_del(int i);		//删除
	int list_get(int i);		//获取
	void list_display();		//打印全表
};

SeqList::SeqList() {		//默认构造
	maxsize = 1000;
	size = 0;
	list = new int[maxsize];
}

SeqList::SeqList(int* data,int n) {
	maxsize = 1000;
	size = n;
	list = new int[maxsize];
	memcpy(list, data, sizeof(data)*n);
}

SeqList::~SeqList()
{
	delete[] list;
}

int SeqList::list_size() {
	return size;
}
int SeqList::list_insert(int i, int item) {
	if (i < 0 || i > size) {
		cout << "error\n";
		return -1;
	}
	//插入，后移
	size++;
	for (int j = size; j > i ; j--) {
		list[j] = list[j-1];
	}
	list[i] = item;
	return 0;
}
int SeqList::list_del(int i) {
	if (i < 0 || i > size) {
		cout << "error\n";
		return -1;
	}
	//删除，前移
	for (int j = i; j < size; j++) {
		list[j] = list[j + 1];
	}
	size--;
	return 0;
}
int SeqList::list_get(int i) {
	if (i < 1 || i >= size) {
		cout << "error\n";
		return -1;
	}
	return list[i];
}
void SeqList::list_display() {
	cout << size << " ";
	for (int i = 0; i < size; i++) {
		cout << list[i]<<" ";
	}
	cout << endl;
}


int main() {
	int n, index,temp;
	cin >> n;
	int* data = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> data[i];
	}
	SeqList list(data, n);
	list.list_display();

	//插入两次
	cin >> index >> temp;
	if(list.list_insert(index-1, temp)!=-1)list.list_display();
	cin >> index >> temp;
	if (list.list_insert(index - 1, temp) != -1)list.list_display();


	//删除两次
	cin >> index;
	if(list.list_del(index - 1)!=-1)list.list_display();
	cin >> index;
	if (list.list_del(index - 1) != -1)list.list_display();

	//查找两次
	cin >> index;
	if(list.list_get(index - 1)!=-1)cout<< list.list_get(index - 1)<<endl;
	cin >> index;
	if (list.list_get(index - 1) != -1)cout << list.list_get(index - 1) << endl;



}